﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XCommunity.Caching;
using XCommunity.Frames;

namespace XCommunity.Forums.Extension
{
  internal class TopicExtMetaCache : CacheContainer
  {


    private ForumsViewPlugin _plugin;

    public TopicExtMetaCache( ForumsViewPlugin plugin )
    {
      _plugin = plugin;
    }


    public ForumsViewPlugin PluginInstance
    {
      get { return _plugin; }
    }

    public TopicExtData GetOrLoad( GeneralTopicFrame topic )
    {
      return GetOrLoadValue( topic.TopicId, id => new TopicExtData( id, PluginInstance.DataProvider ) );
    }

  }
}
